package mespp.monitor.model.service;

import java.sql.SQLException;
import java.util.ArrayList;

import mespp.monitor.dto.MonitorWipDTO;
import mespp.monitor.model.dao.MonitorDAO;
import mespp.processManage.model.dao.ErrorItemDAO;
import mespp.processManage.model.dao.LotDAO;
import mespp.processManage.model.dao.ProcessManageDAO;
import mespp.processManage.model.dao.StationDAO;
import mespp.processManage.model.dao.WipDAO;
import mespp.processManage.model.dao.WorkOrderDAO;

public class MonitorServiceImpl implements MonitorService{
	private MonitorDAO monitorDAO;
	private StationDAO stationDAO;
	private ErrorItemDAO errorItemDAO;
	private ProcessManageDAO processManageDAO;
	private WipDAO wipDAO;
	private WorkOrderDAO workOrderDAO;
	private LotDAO lotDAO;
	
	
	public void setMonitorDAO(MonitorDAO monitorDAO){
		this.monitorDAO = monitorDAO;
	}
	
	public void setStationDAO(StationDAO stationDAO) {
		this.stationDAO = stationDAO;
	}

	public void setErrorItemDAO(ErrorItemDAO errorItemDAO) {
		this.errorItemDAO = errorItemDAO;
	}
	public void setWipDAO(WipDAO wipDAO){
		this.wipDAO = wipDAO;
	}

	@Override
	public ArrayList doGetStationAllStatus() throws SQLException {
		return stationDAO.selectStationMonitor();
	}

	@Override
	public ArrayList doGetStationStatusById(String id) throws SQLException {
		return null;
	}

	@Override
	public ArrayList doGetAllErrorStatus() throws SQLException {
		return null;
	}

	@Override
	public int doSetTurnPowerOnOff(boolean flag) throws SQLException {
		return 0;
	}

	@Override
	public ArrayList doGetLastErrorStatus() throws SQLException {
		ArrayList list = errorItemDAO.selectLastErrorItemMonitor();
		System.out.println("MonitorServiceImpl Error List: " + list);
		return list;
		//return errorItemDAO.selectLastErrorItemMonitor();
	}

	@Override
	public ArrayList<MonitorWipDTO> doGetWIPStatus(String workOrderId) throws SQLException {
		return wipDAO.monitorWipContent(workOrderId);
	}
	
}
